<?php foreach($rs1 as $r)?>
<p>&nbsp;</p>
<div align="center">
  <h1>ตารางกรอกข้อมูลคุณภาพสินค้า Final Check</h1>
</div>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="62%" valign="top"><strong>Data Detail<br />
      <br />
      </strong>
      <table width="90%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#94c0d2">
        <tr>
          <td width="11%" height="32" bgcolor="#DAECF4">&nbsp;Date</td>
          <td width="22%" align="center"><?php echo $r['modify_date']; ?></td>
          <td width="17%" bgcolor="#DAECF4">&nbsp;Total Pallet</td>
          <td width="15%" align="center"><?php echo $r['total_pallet']; ?></td>
          <td width="18%" bgcolor="#DAECF4">&nbsp;ทะเบียนรถ</td>
          <td width="17%" align="center"><?php echo $r['numbercar']; ?></td>
        </tr>
        <tr>
          <td height="30" bgcolor="#DAECF4">&nbsp;Order</td>
          <td align="center"><?php echo $r['order']; ?></td>
          <td bgcolor="#DAECF4">&nbsp;Customer</td>
          <td align="center"><?php echo $r['customer']; ?></td>
          <td bgcolor="#DAECF4">&nbsp;Grade</td>
          <td align="center"><?php echo $r['grade']; ?></td>
        </tr>
        <tr>
          <td height="30" bgcolor="#DAECF4">&nbsp;Order No.</td>
          <td align="center"><?php echo $r['order_no']; ?></td>
          <td bgcolor="#DAECF4">&nbsp;Product</td>
          <td align="center"><?php echo $r['product']; ?></td>
          <td bgcolor="#DAECF4">&nbsp;Problem</td>
          <td align="center">&nbsp;</td>
        </tr>
        <tr>
          <td height="30" colspan="6" align="center"><?php if($r["status"] == 1)
    { echo "<h2>Status :: <font color=green>Active</font></h2>";} 
    else 
    {
    	echo "<h2>Status :: <font color=red>No Active</font></h2>";
      
     } 
    ?></td>
        </tr>
      </table></td>
    <td width="38%" valign="top"><strong><br />
      <br />
      </strong></td>
  </tr>
</table>
<p>&nbsp;</p>
<table width="60%" align="center" class="font">
  <tr>
    <td><table id="grid">
        <thead>
          <tr>
            <th data-field="Properties">Properties Item</th>
            <th data-field="Value1">Value</th>
            <th data-field="Value2">Value</th>
            <th data-field="Unit">Unit</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>สภาพตั้งกระดาษก่อนแกะ Flim ออกตรวจสอบ</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']=='finalcheckFC10')
				  {
					echo $r['value_start'];
				  }
			  }
			  ?></td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']=='finalcheckFC10')
				  {
					echo $r['value_end'];
				  }
			  }
			  ?></td>
            <td>ppm.</td>
          </tr>
          <tr>
            <td>การพัน Flim รอบตั้ง</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']=='finalcheckFC11')
				  {
					echo $r['value_start'];
				  }
			  }
			  ?></td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']=='finalcheckFC11')
				  {
					echo $r['value_end'];
				  }
			  }
			  ?></td>
            <td>แผ่น</td>
          </tr>
          <tr>
            <td>สายรัดยึดแผ่น MDF   พาเลทและกล่อง</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']=='finalcheckFC12')
				  {
					echo $r['value_start'];
				  }
			  }
			  ?></td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']=='finalcheckFC12')
				  {
					echo $r['value_end'];
				  }
			  }
			  ?></td>
            <td>No.</td>
          </tr>
          <tr>
            <td>สภาพกล่องหลังจากแกะFlim และสายรัดพาเลทออก</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']=='finalcheckFC13')
				  {
					echo $r['value_start'];
				  }
			  }
			  ?></td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']=='finalcheckFC13')
				  {
					echo $r['value_end'];
				  }
			  }
			  ?></td>
            <td>1=Long grain,2=Shot grain</td>
          </tr>
          <tr>
            <td>สายรัดกล่อง</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']=='finalcheckFC14')
				  {
					echo $r['value_start'];
				  }
			  }
			  ?></td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']=='finalcheckFC14')
				  {
					echo $r['value_end'];
				  }
			  }
			  ?></td>
            <td>แผ่น</td>
          </tr>
          <tr>
            <td>สภาพกล่องและฝาขณะยกออกจากพาเลทเพื่อตรวจสอบ</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']=='finalcheckFC15')
				  {
					echo $r['value_start'];
				  }
			  }
			  ?></td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']=='finalcheckFC15')
				  {
					echo $r['value_end'];
				  }
			  }
			  ?></td>
            <td>mm.</td>
          </tr>
          <tr>
            <td>สภาพ Pallet หลังจากยกกล่องออกตรวจสอบ</td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']=='finalcheckFC16')
				  {
					echo $r['value_start'];
				  }
			  }
			  ?></td>
            <td><?php 
			  foreach($rs2 as $r)
			  {
				  if($r['data_name']=='finalcheckFC16')
				  {
					echo $r['value_end'];
				  }
			  }
			  ?></td>
            <td>mm.</td>
          </tr>
        </tbody>
      </table>
    <script>
                $(document).ready(function() {
                    $("#grid").kendoGrid({
						columns: [
						{ field: "Properties", width: "125px" },
						{ field: "Value1", width: "20px" },
						{ field: "Value2", width: "20px" },
						{ field: "Unit",  width: "40px" }
						],
                        //height: 1000,
						//pageable: true,
						dataSource: {
						//pageSize: 12
						} 
                    });
                });
            </script></td>
  </tr>
</table>

<!--scrip list select--> 
<script>
                $(document).ready(function() {
                    var viewModel = {
                        chosenTicket: ko.observable(),
                        resetTicket: function() { this.chosenTicket(null) },
                    };
                    $("#ticket1").kendoDropDownList().trigger("change");
                    $("#ticket2").kendoDropDownList().trigger("change");
                    $("#ticket3").kendoDropDownList().trigger("change");
                    $("#ticket4").kendoDropDownList().trigger("change");
                });
      		</script> 
<!--scrip วัน-เดือน-ปี--> 
<script>
                $(document).ready(function() {
                    var today = new Date(),
                        birthdays = [
                           +new Date(today.getFullYear(), today.getMonth(), 11),
                           +new Date(today.getFullYear(), today.getMonth() + 1, 6),
                           +new Date(today.getFullYear(), today.getMonth() + 1, 27),
                           +new Date(today.getFullYear(), today.getMonth() - 1, 3),
                           +new Date(today.getFullYear(), today.getMonth() - 2, 22)
                        ];

                    $("#datepicker").kendoDatePicker({
                        value: today,
                        month: {
                            // template for dates in month view
                            content: '# if ($.inArray(+data.date, [' + birthdays + ']) != -1) { #' +
                                         '<div class="birthday"></div>' +
                                     '# } #' +
                                     '#= data.value #'
                        },
                        footer: "Today - #=kendo.toString(data, 'd') #"
                    });

                    $("#datepicker").data("kendoDatePicker")
                                    .dateView.calendar.element
                                    .width(300);
                });
            </script> 
<!--scrip เวลา--> 
<script>
                $(document).ready(function() {
                    // create TimePicker from input HTML element
                    $("#timepicker").kendoTimePicker();
                });
            </script>